package com.naizhuai.Model.db.eneity;

import android.arch.persistence.room.TypeConverter;

import java.util.Date;

/**
 * @author：lichenxi
 * @date 2018/1/4 19
 * email：525603977@qq.com
 * Fighting
 */
public class DateConverter {
    @TypeConverter
    public static Date toDate(Long timestamp) {
        return timestamp == null ? null : new Date(timestamp);
    }

    @TypeConverter
    public static Long toTimestamp(Date date) {
        return date == null ? null : date.getTime();
    }
}
